package com.explore.demo.controller;

import com.explore.demo.common.ServerResponse;
import com.explore.demo.service.FileUploadService;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;

/**
 * @author gaolainan
 */
@RestController
@RequestMapping("/file")
@CrossOrigin
public class FileUploadController
{
    @Resource
    private FileUploadService fileUploadService;

    @GetMapping
    @ApiOperation("测试")
    public ServerResponse getPath(){
        return ServerResponse.createByErrorMessage("文件测试的接口");
    }


    @PostMapping("/upload")
    @ApiOperation("上传文件的接口")
    public ServerResponse upload(MultipartFile file){
        return fileUploadService.upload(file);
    }


}
